<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<link rel="stylesheet" type="text/css" href="${static_url}/ui/app/assets/js/plugin/autocomplete/jquery.autocomplete.css"/>
<script type="text/javascript" src="${static_url}/ui/app/assets/js/plugin/autocomplete/jquery.autocomplete.min.js"></script>
<c:if test="${param.house}">
    <input type="hidden" name="house.provinceId" value="42"/>
    <input type="hidden" name="house.cityId" value="4201"/>
    <tr>
        <th><span class="required">*</span><label for="communityName">小区名称：</label></th>
        <td>
            <input  type="text" name="house.communityName" id="communityName" class="text "  value="${goods.house.communityName}"
                    data-rule="required;length[2~100];"
                    data-msg-required="请输入小区名称"
                    data-ok=""
                    data-target="#communityName-msg">
            <label id="communityName-msg"></label>
            <script>
                $(function(){
                    $('#communityName').AutoComplete({
                        'data': "${ctx}/my/seller/xiaoqu.htm",
                        'ajaxDataType': 'json',
                        'onerror': function(msg){alert(msg);}
                    });
                });
            </script>
        </td>
    </tr>
    <tr>
        <th><span class="required">*</span><label for="owner">房主姓名：</label></th>
        <td>
            <input maxlength="20" type="text" name="house.owner" id="owner" class="text " value="${goods.house.owner}"
                   data-rule="required;"
                   data-msg-required="请输入房主姓名"
                   data-ok=""
                   data-target="#owner-msg">
            <label id="owner-msg"></label>
        </td>
    </tr>
    <tr>
        <th><span class="required">*</span><label for="owner">房主电话：</label></th>
        <td>
            <input maxlength="20" type="text" name="house.ownerPhone" id="ownerPhone" class="text " value="${goods.house.ownerPhone}"
                   data-rule="required;mobile;"
                   data-msg-required="请输入房电话"
                   data-ok=""
                   data-target="#ownerPhone-msg">
            <label id="ownerPhone-msg"></label>
        </td>
    </tr>
    <tr>
        <th><span class="required">*</span><label for="houseSize">面积：</label></th>
        <td>
            <input maxlength="20" type="text" name="house.houseSize" id="houseSize" class="text w40" value="${goods.house.houseSize}"
                   data-rule="required;integer;"
                   data-msg-required="请输入商品面积"
                   data-ok=""
                   data-target="#houseSize-msg">(平方米)
            <label id="houseSize-msg"></label>
        </td>
    </tr>

    <tr>
        <th><span class="required">*</span><label>房型：</label></th>
        <td>
            <select name="house.room" data-rule="required;"
                    data-msg-required="请选择几室"
                    data-ok=""
                    data-target="#houseType-msg">
                <option value="">请选择...</option>
                <option value="1">1室</option>
                <option value="2">2室</option>
                <option value="3">3室</option>
                <option value="4">4室</option>
                <option value="5">5室</option>
                <option value="6">5室以上</option>
            </select>
            <select name="house.hall" data-rule="required;"
                    data-msg-required="请选择几厅"
                    data-ok=""
                    data-target="#houseType-msg">
                <option value="">请选择...</option>
                <option value="1">1厅</option>
                <option value="2">2厅</option>
                <option value="3">3厅</option>
                <option value="4">4厅</option>
                <option value="5">5厅</option>
                <option value="6">5厅以上</option>
            </select>
            <select name="house.toilet" data-rule="required;"
                    data-msg-required="请选择几卫"
                    data-ok=""
                    data-target="#houseType-msg">
                <option value="">请选择...</option>
                <option value="1">1卫</option>
                <option value="2">2卫</option>
                <option value="3">3卫</option>
                <option value="4">4卫</option>
                <option value="5">5卫</option>
                <option value="6">5卫以上</option>
            </select>
            <select name="house.cookroom" data-rule="required;"
                    data-msg-required="请选择几厨"
                    data-ok=""
                    data-target="#houseType-msg">
                <option value="">请选择...</option>
                <option value="1">1厨</option>
                <option value="2">2厨</option>
                <option value="3">3厨</option>
                <option value="4">4厨</option>
                <option value="5">5厨</option>
                <option value="6">5厨以上</option>
            </select>
            <label id="houseType-msg"></label>
        </td>
    </tr>

    <tr>
        <th><span class="required">*</span><label>房龄年代：</label></th>
        <td>


            <link type="text/css" rel="stylesheet" href="${static_url}/ui/app/assets/js/plugin/laydate/need/laydate.css">
            <link type="text/css" rel="stylesheet" href="${static_url}/ui/app/assets/js/plugin/laydate/skins/danlan/laydate.css">
            <script type="text/javascript" src="${static_url}/ui/app/assets/js/plugin/laydate/laydate.js"></script>
            <input type="text" name="house.buildYear" id="laydate_ui"  value="<fmt:formatDate value="${goods.house.buildYear}" pattern="yyyy-MM-dd"/>" class="text w100"
                   readonly="readonly"
                   data-rule="required;"
                   data-msg-required="请输入商品房龄年代"
                   data-ok=""
                   data-target="#buildYear-msg">
            <label id="buildYear-msg"></label>
            <script>
                laydate({
                    elem: '#laydate_ui', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
                    event: 'focus' //响应事件。如果没有传入event，则按照默认的click
                });
            </script>
        </td>
    </tr>
    <tr>
        <th><span class="required">*</span><label for="orientation">朝向：</label></th>
        <td>



            <select name="house.orientation" id="orientation" class="ec_linkSelect"
                    data-rule="required;"
                    data-msg-required="请选择朝向"
                    data-ok=""
                    data-target="#orientation-msg">
                <option value="">请选择...</option>
                <option value="东">东</option>
                <option value="南">南</option>
                <option value="西">西</option>
                <option value="北">北</option>
                <option value="南北">南北</option>
                <option value="东西">东西</option>
            </select>
            <label id="orientation-msg"></label>
        </td>
    </tr>
    <tr>
        <th><span class="required">*</span><label for="decorate">装修：</label></th>
        <td>
            <select name="house.decorate" id="decorate" class="ec_linkSelect"
                    data-rule="required;"
                    data-msg-required="请选择朝向"
                    data-ok=""
                    data-target="#decorate-msg">
                <option value="">请选择...</option>
                <option value="毛坯">毛坯</option>
                <option value="简装">简装</option>
                <option value="精装">精装</option>
            </select>
            <label id="decorate-msg"></label>
        </td>
    </tr>
    <tr>
        <th><span class="required">*</span><label>楼层：</label></th>
        <td>
            <input maxlength="20" type="text" name="house.houseFloor1" id="houseFloor1" class="text w40"
                   value="${goods.house.houseFloor1}"
                   data-rule="required;integer;"
                   data-msg-required="请输入楼层"
                   data-ok=""
                   data-target="#houseFloor-msg">楼
            <input maxlength="20" type="text" name="house.houseFloor2" id="houseFloor2" class="text w40"
                   value="${goods.house.houseFloor2}"
                   data-rule="required;integer;"
                   data-msg-required="请输入总楼层"
                   data-ok=""
                   data-target="#houseFloor-msg">总楼层
            <label id="houseFloor-msg"></label>
        </td>
    </tr>
    <tr>
        <th><span class="required">*</span><label for="areaId">城区：</label></th>
        <td>
            <select name="house.areaId" id="areaId" class="ec_linkSelect"
                    data-rule="required;"
                    data-msg-required="请选择城区"
                    data-ok=""
                    data-target="#areaId-msg">
                <option value="">请选择...</option>
                <option value="420101">市辖区</option>
                <option value="420102">江岸区</option>
                <option value="420103">江汉区</option>
                <option value="420104">硚口区</option>
                <option value="420105">汉阳区</option>
                <option value="420106">武昌区</option>
                <option value="420107">青山区</option>
                <option value="420111">洪山区</option>
                <option value="420112">东西湖区</option>
                <option value="420113">汉南区</option>
                <option value="420114">蔡甸区</option>
                <option value="420115">江夏区</option>
                <option value="420116">黄陂区</option>
                <option value="420117">新洲区</option>
            </select>
            <label id="areaId-msg"></label>
        </td>
    </tr>
    <script>
        $(function(){
            $("select[name='house.room']").val("${goods.house.room}");
            $("select[name='house.hall']").val("${goods.house.hall}");
            $("select[name='house.toilet']").val("${goods.house.toilet}");
            $("select[name='house.cookroom']").val("${goods.house.cookroom}");
            $("select[name='house.orientation']").val("${goods.house.orientation}");
            $("select[name='house.decorate']").val("${goods.house.decorate}");
            $("select[name='house.areaId']").val("${goods.house.areaId}");
        });
    </script>
</c:if>

